const axios =require('axios');
const chalk=require('chalk');
exports.actionHandle=async (options)=>{
    // console.log(process.argv);
    const result=await axios.get('https://restapi.amap.com/v3/weather/weatherInfo?parameters',{//请求数据
        params: {
            key:'f93eb7ed755e7fb4974bf634bccdfd3e',
            city:process.argv[process.argv.length-1]
        },
    });
    if(result.status==200){
        let weather_info=result.data.lives[0];
        console.log(chalk.yellow(`城市：${weather_info.city}`),chalk.blue(`今天的天气：${weather_info.weather}`),chalk.red(`风力：${weather_info.windpower}级`),chalk.green(`空气湿度：${weather_info.humidity}`));
    }else{
        console.log(chalk.red('请求失败'));
    }
   
}